//
//  ViewController.m
//  CLPPbutton
//
//  Created by 小草毋正 on 2018/3/16.
//  Copyright © 2018年 zwc. All rights reserved.
//

#import "ViewController.h"
#import "CLNumberButton.h"


@interface ViewController ()


@property (nonatomic, strong) CLNumberButton *numberButton;



@end




@implementation ViewController



- (void)viewDidLoad {
    
    [super viewDidLoad];
    
    [self.view addSubview:self.numberButton]; 
    self.numberButton.editing = YES;
    self.numberButton.shakeAnimation = YES;
    self.numberButton.descreaseHide = YES;
    self.numberButton.increaseImage = [UIImage imageNamed:@"add_style2"];
    self.numberButton.decreaseImage = [UIImage imageNamed:@"reduce_style2"];
    self.numberButton.minValue = 1;
    self.numberButton.maxValue = 20;
    self.numberButton.currentValue = 5;
    self.numberButton.resultBlock = ^(NSInteger number, BOOL increaseStatus) {
        NSLog(@"number:%ld", number);
    };
}



- (CLNumberButton *)numberButton {
    if(!_numberButton) {
        _numberButton = [[CLNumberButton alloc] initWithFrame:CGRectMake(100, 200, 120, 30)];
    }
    return _numberButton;
}



- (void)touchesBegan:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event {
    [self.view endEditing:YES];
}


- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}


@end
